package com.singzi.leetcode.N200;

import java.util.ArrayList;
import java.util.List;

public class T0119 {
    public static void main(String[] args) {
        Solution0119 solution0119 = new Solution0119();
        solution0119.getRow(10);
    }
}
class Solution0119 {
    //第n行的数字有n项。
    //第n行的m个数可表示为 C(n-1，m-1)
    public List<Integer> getRow(int rowIndex) {
        int nResult = 1,mResult = 1;
        for (int j = 1; j <= rowIndex-1; j++) {
            nResult = nResult*j;

        }


        List<Integer> list = new ArrayList<>();
        for (int i = 1; i <= rowIndex; i++) {
            if(i==1) {
                list.add(1);
                continue;
            }
            mResult = i*mResult;
            list.add(nResult/mResult/mResult);
        }
        return list;
    }
}